<?php
if (!defined('W_ROOT')) {
	exit();
}

	require_once('../../libraryfiles/dbconfig.php');
		 $sql = "SELECT * FROM tbluser AS u INNER JOIN tbluser_type AS u_t ON u.user_type_id = u_t.user_type_id WHERE id='".@$_SESSION['acc_id']."'";
		$qury = mysql_query($sql);
	if(@mysql_num_rows($qury) > 0){
		while($info = mysql_fetch_object( $qury )){
			$FirstName = $info->first_name; 
			$LastName  = $info->last_name;
			$Email	   = $info->email;
			$Phone	   = $info->phone;
			$Address   = $info->address;
			$UserName  = $info->username;
			$UserType  = $info->user_type_name;
		}
	}
?>
<div class="breadcrumb">
        <a href="<?php echo base_url_admin;?>"><?php echo $lang['HOME'];?></a>
         :: <a href="index.php?view=list"><?php echo $lang['LIST_USER'];?></a>
         :: <a href="#">User Profile</a>
      </div>
<div class="heading">
	<h1><img src="../templates/image/user.png" alt="" />Profile</h1>
	
	<form action="<?php echo base_url_admin?>/user/process.php?action=updateprofile" method="post" name="frmlist">
	<div class="buttons">
	<?php 
		if(isset($_GET['edit']) && $_GET['edit']==1){
	?>
	<input class="button" type="submit" name="btnsave" value="<?php echo $lang['SAVE'] ;?>"/>
	<?php }else{?>
	<a href="<?php echo base_url_admin?>/user/index.php?view=changepassword" class="button">Change Password</a>
	<a href="<?php echo base_url_admin?>/user/index.php?view=userprofile&edit=1" class="button">Edit Profile</a>
	<?php } ?>
	<a href="<?php echo base_url_admin?>/user/index.php?view=userprofile" class="button"><?php echo $lang['BACK'];?></a></div>
</div>
<div class="content">
	<?php if(isset($_GET['message']) && @$_GET['message']=='errorpas'){?>
	<div class="warning"><?php echo ($_GET['message']=='errorpas')?"Your old password is incorrect!":"";?></div>
	<?php }?>
	<?php if(isset($_GET['message']) && $_GET['message']=='compass'){?>
	<div class="warning"><?php echo ($_GET['message']=='compass')?"New password and Comirm password are not matched!":"";?></div>
	<?php }?>
	<?php if(isset($_GET['message']) && $_GET['message']=='required'){?>
	<div class="warning"><?php echo ($_GET['message']=='required')?"Field is required!":"";?></div>
	<?php }?>
	<?php if(isset($_GET['message']) && $_GET['message']=='prosuccess'){?>
	<div class="success"><?php echo ($_GET['message']=='prosuccess')?"Your profile is updated.":"";?></div>
	<?php }?>
	<?php if(isset($_GET['message']) && $_GET['message']=='mailexist'){?>
	<div class="warning"><?php echo ($_GET['message']=='mailexist')?"Your mail is exist!":"";?></div>
	<?php }?>
	<?php if(isset($_GET['message']) && $_GET['message']=='invalidformat'){?>
	<div class="warning"><?php echo ($_GET['message']=='invalidformat')?"Your Email is invalid format!":"";?></div>
	<?php }?>
<form action="process.php?action=add" method="post" name="frmlist">
<table cellpadding="5" cellspacing="5" border="0" width="100%" align="center">
<tr> 
   <td width="10%" height="30" align="left" valign="top"><!--First Name--><?php echo $lang['SHIP_FIR_NAME'] ;?></td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input size="50" <?php echo empty($_GET['edit'])?"disabled":"";?> name="txt_firstname" type="text"  alt="required" id="txttitle"  value="<?php echo @$FirstName; ?>"  />
   </td>
</tr>
<tr> 
   <td width="10%" height="30" align="left" valign="top"><!--Last Name--><?php echo $lang['SHIP_LAS_NAME'];?></td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input size="50" <?php echo empty($_GET['edit'])?"disabled":"";?>  name="txt_lastname" type="text"  id="txtmeta_key"  value="<?php echo @$LastName; ?>"  />
   </td>
</tr>

<tr> 
   <td width="10%" height="30" align="left" valign="top"><!--Email Address--><?php echo $lang['LOG_EMAIL'];?></td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input size="50" name="txtemail" <?php echo empty($_GET['edit'])?"disabled":"";?> type="text"  id="txtemail"  value="<?php echo @$Email; ?>"  />
   </td>
</tr>
<tr> 
   <td width="10%" height="30" align="left" valign="top">User Name</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input size="50" name="txtusername" <?php echo empty($_GET['edit'])?"disabled":"";?> type="text"  id="txtusername"  value="<?php echo @$UserName; ?>"  />
   </td>
</tr>
<?php if(empty($_GET['edit'])){?>
<tr> 
   <td width="10%" height="30" align="left" valign="top"><!--Email Address-->User Type</td>
   <td width="5%" align="left" valign="top">:</td>
	<td width="80%" align="left">
		<input size="50" name="txtphone" <?php echo empty($_GET['edit'])?"disabled":"";?> type="text"  id="txtphone"  value="<?php echo @$UserType; ?>"  />
   </td>
</tr>
<?php }?>
<tr> 
   <td width="10%" height="30" align="left" valign="top">Address</td>
   <td width="5%" align="left" valign="top">:</td>
   <td width="80%" align="left">
        <input size="50" name="txtaddress" <?php echo empty($_GET['edit'])?"disabled":"";?> type="text"  id="txtaddress"  value="<?php echo @$Address; ?>"  />
   </td>
</tr>
<tr> 
   <td width="10%" height="30" align="left" valign="top"><!--Email Address-->Phone</td>
   <td width="5%" align="left" valign="top">:</td>
	<td width="80%" align="left">
		<input size="50" name="txtphone" <?php echo empty($_GET['edit'])?"disabled":"";?> type="text"  id="txtphone"  value="<?php echo @$Phone; ?>"  />
   </td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>
</table>
</form>
</div>
</div><!--<div class="row">-->